package cn.edu.zzuli.nothinglink.controller;


import cn.edu.zzuli.nothinglink.anno.CurrentUser;
import cn.edu.zzuli.nothinglink.entity.R;
import cn.edu.zzuli.nothinglink.service.WorkPutPostponeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author suzyyy
 * @since 2021-04-08
 */
@RestController
@RequestMapping("/work-put-postpone-record")
public class WorkPutPostponeRecordController {

    @Autowired
    WorkPutPostponeRecordService workPutPostponeRecordService;

    @PostMapping("/put/{workId}")
    public R workPostpone(@PathVariable Integer workId, @CurrentUser Integer stuId) {
        return workPutPostponeRecordService.putWorkPostpone(workId, stuId);
    }

    @GetMapping("/get")
    public R getPostponeRecord(@CurrentUser Integer stuId) {
        if (stuId == null) return R.error().add("error", "请先登陆");
        return workPutPostponeRecordService.getRecords(stuId);
    }

}

